<?php

namespace App\Http\Controllers\Home;

use App\Models\Member;

class MemberController extends BaseController
{

    public function __construct(Member $member)
    {
        parent::__construct();
        $this->member = $member;
    }

    // 就诊人列表
    public function getMemberList()
    {
        $res = $this->member->getMemberList();
        return ajax_return($res);
    }

    // 就诊人列表
    public function getMyMemberList()
    {
        $res = $this->member->getMyMemberList();
//        dd($res);
        return ajax_return($res);
    }

    // 删除就诊人
    public function getDelMember(){
//         $where['id'] = request('id');
//         $user = new \App\Models\User();
//         $u_where['id'] = request('mid');
//         $res = $user->getOne($u_where)->toArray();
//         $updata['member_count'] = $res['member_count'] - 1;
//         $user->up($u_where, $updata); // 更新就诊人数量
//         $res = $this->member->del($where);
//         if($res){
//             $res = ['state'=>1,'msg'=>'ok'];
//         }else{
//             $res = ['state'=>0,'msg'=>'fail'];
//         }
                 $res = $this->member->delMember();
         return ajax_return($res);
    }

    /**
     *  获取档案记录
     */
    public function getMemberReport(){
         $res = $this->member->getMemberReport(request());
         return ajax_return($res);
    }

    /**
     *  获取住院缴费记录
     */
    public function getMemberChargeList(){
          $res = $this->member->getMemberCharge(request());
          return ajax_return($res);
    }

    /**
     * 获取每日治疗清单
     */
    public function getDayInpList(){
           $res = $this->member->getInptList(request());
           return ajax_return($res);
    }


    /**
     * 获取
     */
    public function getVaj(){
          $res = $this->member->getVAJ(request());
          return ajax_return($res);
    }

    /**
     * 获取病例报告
     * @return \Illuminate\Http\JsonResponse
     */
    public function getVal(){
           $res = $this->member->getVAQ(request());
           return ajax_return($res);
    }

    /**
     * 获取病例内容
     */
    public function getVar(){
           $res = $this->member->getvar(request());
           return ajax_return($res);
    }

    /**
     *获取检验列表
     */
    public function getLisReport(){
           $res = $this->member->getListReport(request());
           return ajax_return($res);
    }

    /**
     * 获取检验详情
     */
    public function getLisReportInfo(){
           $res = $this->member->ListReportInfo(request());
           return ajax_return($res);
    }

    /**
     * 获取检查列表
     * @return \Illuminate\Http\JsonResponse
     */
    public function getRisReportDetail(){
           $res = $this->member->risReportDetail(request());
           return ajax_return($res);
    }

    /**
     * 检测病例
     * @return mixed
     */
    public function getVaf(){
            $res = $this->member->getVAF(request());
            return ajax_return(array("data"=>$res));
    }

    /**
     * 获取病例pdf
     * @return \Illuminate\Http\JsonResponse
     */
    public function getVaq(){
           $res = $this->member->getVAQ(request());
           return $res;
    }

    // 添加就诊人
    public function postAddMember()
    {
        $res = $this->member->addMember(request());
        return ajax_return($res);
    }

}
